package A01_实现线程的方式;

import java.util.Timer;
import java.util.TimerTask;

/**
 * @author liujun
 * @version 1.0
 * @date 2020/9/12
 * @author—Email liujunfirst@outlook.com
 * @blogURL https://blog.csdn.net/ljfirst
 * @description 使用 Timer 实现线程
 */
public class aa08_Timer {

    public static void main(String[] args) {
        TimerTask timerTask = new TimerTask() {
            @Override
            public void run() {
                System.out.println("i am timerTask");
            }
        };
        Timer t = new Timer();
        t.scheduleAtFixedRate(timerTask, 2 * 1_000, 2 * 1_000);
    }
}
